package jinyilw.swing;
import javax.swing.AbstractListModel;
import javax.swing.ComboBoxModel;
import java.util.ArrayList;
public class ArrayListComboBoxModel<T> extends AbstractListModel implements ComboBoxModel
{
	private Object selectedItem;

	private final ArrayList<T> anArrayList;

	public ArrayListComboBoxModel(ArrayList<T> arrayList)
	{
		anArrayList = arrayList;
	}

	public Object getSelectedItem()
	{
		return selectedItem;
	}

	public void setSelectedItem(Object newValue)
	{
		selectedItem = newValue;
	}

	public int getSize()
	{
		return anArrayList.size();
	}

	public Object getElementAt(int i)
	{
		return anArrayList.get(i);
	}
}
